var request = require('../ajax').request
var host = require('../config').hostData.default

// 登录
export const login = (data) => {
  return new Promise((resolve, reject) => {
    request({
      type: 'default',
      data: data,
      url: host + '/app-api/member/auth/weixin-mini-app-login',
      method: 'POST',
    }, resolve, reject)
  })
}

// 退出
export const logout = (data) => {
  return new Promise((resolve, reject) => {
    request({
      type: 'default',
      url: host + '/app-api/member/auth/logout',
      method: 'POST',
    }, resolve, reject)
  })
}

// 获取用户详情
export const getUserInfo = (data) => {
  return new Promise((resolve, reject) => {
    request({
      type: 'default',
      url: host + '/app-api/member/user/get',
      method: 'GET',
    }, resolve, reject)
  })
}

// 修改用户详情
export const updateUserInfo = (data) => {
  return new Promise((resolve, reject) => {
    request({
      type: 'default',
      data: data,
      url: host + '/app-api/member/user/update',
      method: 'PUT',
    }, resolve, reject)
  })
}


// 获取订阅模板
export const getTemplateList = (data) => {
  return new Promise((resolve, reject) => {
    request({
      type: 'default',
      data: data,
      url: host + '/app-api/member/yzh/getTemplateList',
      method: 'GET',
    }, resolve, reject)
  })
}